#include "Logger.h"
#include <iostream>
#include "TimeStamp.h"
namespace mymuduo {

Logger& Logger::instance() {
    static Logger logger;
    return logger;
}

void Logger::setLogLevel(int level) {
    log_level_ = level;
}

void Logger::log(std::string msg) {
    // 打印日志等级
    switch (log_level_)
    {
    case INFO:
        /* code */
        std::cout << "[INFO]";
        break;
    case ERROR:
        std::cout << "[ERROR]";
        break;
    case FATAL:
        std::cout << "[FATAL]";
        break;
    case DEBUG:
        std::cout << "[FATAL]";
        break;
    default:
        break;
    }
    // 打印当前时间和 msg
    std::cout << TimeStamp::now().toString() << " : " << msg << std::endl;
}

} // namespace name